package main

import (
	"caches/cache"
	"time"
)

var testData = map[string]string{
	"key1": "value1",
	"key2": "value3",
	"key3": "value3",
}

func main() {
	c := cache.NewCache[string, string](1*time.Second, 2*time.Second)
	c.Append(testData)
	v, found := c.Get("key3")
	if found {
		println("Value of 'key3':", v)
	}

	c.Set("key4", "value4", 0)
	c.Set("key5", "value5", 3*time.Second)

	values := c.Values()
	for _, v := range values {
		println(v)
	}

	time.Sleep(3 * time.Second)

	count := c.Count()
	println("Count items:", count)

	if c.Exists("key5") {
		println("Key 'key5' exists")
	}

	keys := c.Keys()
	for _, k := range keys {
		println(k)
	}

}
